package com.faithbj.common.model.fm;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.faithbj.common.model.BaseEntity;
import com.faithbj.common.model.CheckTotal;

/**
 * 家庭成员基本情况表
 * 
 * @author XiaoQuan
 * 
 */
@Entity
@Table(name = "family_member")
public class FamilyMember extends BaseEntity {

	private static final long serialVersionUID = -1189848055547645033L;
	/**
	 * 关联的核对总体情况表ID
	 */
	private CheckTotal checkTotal;
	/**
	 * 姓名
	 */
	private String name;
	/**
	 * 性别
	 */
	private String gender;
	/**
	 * 出生日期
	 */
	private Date birthday;
	/**
	 * 证件类型
	 */
	private String idType;
	/**
	 * 证件号码
	 */
	private String idNumber;
	/**
	 * 民族
	 */
	private String nation;
	/**
	 * 国籍
	 */
	private String country;
	/**
	 * 政治面貌
	 */
	private String politicalStatus;
	/**
	 * 婚姻状况
	 */
	private String maritalStatus;
	/**
	 * 结婚登记日期
	 */
	private Date marriedDate;
	/**
	 * 户籍类型
	 */
	private String householdType;
	/**
	 * 户籍所在地地址
	 */
	private String householdAddress;
	/**
	 * 户籍所在地行政区划代码
	 */
	private String householdDistrictCode;
	/**
	 * 现居住地地址:regioncode:具体地址
	 */
	private String livingAddress;
	/**
	 * 现居住地行政区划代码
	 */
	private String livingDistrictCode;
	/**
	 * 现居住地开始居住时间
	 */
	private Date startDateLiving;
	/**
	 * 文化程度
	 */
	private String education;
	/**
	 * 健康状况
	 */
	private String healthStatus;
	/**
	 * 劳动能力丧失状况
	 */
	private String laborLossStatus;
	/**
	 * 残疾等级
	 */
	private String disabilityDegree;
	/**
	 * 所患主要疾病名称
	 */
	private String diseaseName;
	/**
	 * 是否主申请人
	 */
	private Boolean mainApplicant;
	/**
	 * 与主申请人关系
	 */
	private String relationMainApplicant;

	/**
	 * 固定电话
	 */
	private String phone;

	/**
	 * 手机号码
	 */
	private String mobile;

	/**
	 * 邮政编码
	 */
	private String zipCode;

	/**
	 * 通讯地址
	 */
	private String contactAddress;

	/**
	 * 家庭成员收入
	 */
	private FamilyMemberIncome income;

	@OneToOne(cascade = { CascadeType.ALL })
	@JoinColumn(name = "income")
	public FamilyMemberIncome getIncome() {
		return income;
	}

	public void setIncome(FamilyMemberIncome income) {
		this.income = income;
	}
	
	@ManyToOne
	@JoinColumn(nullable = true)
	public CheckTotal getCheckTotal() {
		return checkTotal;
	}

	public void setCheckTotal(CheckTotal checkTotal) {
		this.checkTotal = checkTotal;
	}

	@Column(name = "name", length = 30, nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "gender", nullable = true)
	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "birthday", nullable = true)
	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "id_type", nullable = false)
	public String getIdType() {
		return idType;
	}

	public void setIdType(String idType) {
		this.idType = idType;
	}

	@Column(name = "id_number", nullable = false, length = 18)
	public String getIdNumber() {
		return idNumber;
	}

	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	@Column(name = "nation", nullable = true)
	public String getNation() {
		return nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	@Column(name = "country", nullable = true)
	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	@Column(name = "political_status", nullable = true)
	public String getPoliticalStatus() {
		return politicalStatus;
	}

	public void setPoliticalStatus(String politicalStatus) {
		this.politicalStatus = politicalStatus;
	}

	@Column(name = "marital_status", nullable = true)
	public String getMaritalStatus() {
		return maritalStatus;
	}

	public void setMaritalStatus(String maritalStatus) {
		this.maritalStatus = maritalStatus;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "married_date", nullable = true)
	public Date getMarriedDate() {
		return marriedDate;
	}

	public void setMarriedDate(Date marriedDate) {
		this.marriedDate = marriedDate;
	}

	@Column(name = "household_type", nullable = true)
	public String getHouseholdType() {
		return householdType;
	}

	public void setHouseholdType(String householdType) {
		this.householdType = householdType;
	}

	@Column(name = "household_address", nullable = true, length = 80)
	public String getHouseholdAddress() {
		return householdAddress;
	}

	public void setHouseholdAddress(String householdAddress) {
		this.householdAddress = householdAddress;
	}

	@Column(name = "household_district_code", nullable = true)
	public String getHouseholdDistrictCode() {
		return householdDistrictCode;
	}

	public void setHouseholdDistrictCode(String householdDistrictCode) {
		this.householdDistrictCode = householdDistrictCode;
	}

	@Column(name = "living_address", nullable = true, length = 80)
	public String getLivingAddress() {
		return livingAddress;
	}

	public void setLivingAddress(String livingAddress) {
		this.livingAddress = livingAddress;
	}

	@Column(name = "living_district_code", nullable = true)
	public String getLivingDistrictCode() {
		return livingDistrictCode;
	}

	public void setLivingDistrictCode(String livingDistrictCode) {
		this.livingDistrictCode = livingDistrictCode;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "start_date_living", nullable = true)
	public Date getStartDateLiving() {
		return startDateLiving;
	}

	public void setStartDateLiving(Date startDateLiving) {
		this.startDateLiving = startDateLiving;
	}

	@Column(name = "education", nullable = true)
	public String getEducation() {
		return education;
	}

	public void setEducation(String education) {
		this.education = education;
	}

	@Column(name = "health_status", nullable = true)
	public String getHealthStatus() {
		return healthStatus;
	}

	public void setHealthStatus(String healthStatus) {
		this.healthStatus = healthStatus;
	}

	@Column(name = "labor_loss_status", nullable = true)
	public String getLaborLossStatus() {
		return laborLossStatus;
	}

	public void setLaborLossStatus(String laborLossStatus) {
		this.laborLossStatus = laborLossStatus;
	}

	@Column(name = "disability_degree", nullable = true)
	public String getDisabilityDegree() {
		return disabilityDegree;
	}

	public void setDisabilityDegree(String disabilityDegree) {
		this.disabilityDegree = disabilityDegree;
	}

	@Column(name = "disease_name", nullable = true, length = 20)
	public String getDiseaseName() {
		return diseaseName;
	}

	public void setDiseaseName(String diseaseName) {
		this.diseaseName = diseaseName;
	}

	@Column(name = "main_applicant", nullable = false)
	public Boolean getMainApplicant() {
		return mainApplicant;
	}

	public void setMainApplicant(Boolean mainApplicant) {
		this.mainApplicant = mainApplicant;
	}

	

	@Column(name = "relation_main_applicant", nullable = false)
	public String getRelationMainApplicant() {
		return relationMainApplicant;
	}



	public void setRelationMainApplicant(String relationMainApplicant) {
		this.relationMainApplicant = relationMainApplicant;
	}
	@Column(name = "phone")
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name = "mobile")
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	@Column(name = "zip_code")
	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}
	@Column(name = "contact_address")
	public String getContactAddress() {
		return contactAddress;
	}

	public void setContactAddress(String contactAddress) {
		this.contactAddress = contactAddress;
	}

	public void copyProperties(FamilyMember familyMember) {
		setBirthday(familyMember.getBirthday());
		setCountry(familyMember.getCountry());
		setDisabilityDegree(familyMember.getDisabilityDegree());
		setDiseaseName(familyMember.getDiseaseName());
		setEducation(familyMember.getEducation());
		setGender(familyMember.getGender());
		setHealthStatus(familyMember.getHealthStatus());
		setHouseholdAddress(familyMember.getHouseholdAddress());
		setHouseholdDistrictCode(familyMember.getHouseholdDistrictCode());
		setHouseholdType(familyMember.getHouseholdType());
		setIdNumber(familyMember.getIdNumber());
		setIdType(familyMember.getIdType());
		setLaborLossStatus(familyMember.getLaborLossStatus());
		setLivingAddress(familyMember.getLivingAddress());
		setLivingDistrictCode(familyMember.getLivingDistrictCode());
		setMainApplicant(familyMember.getMainApplicant());
		setMaritalStatus(familyMember.getMaritalStatus());
		setMarriedDate(familyMember.getMarriedDate());
		setName(familyMember.getName());
		setNation(familyMember.getNation());
		setPoliticalStatus(familyMember.getPoliticalStatus());
		setStartDateLiving(familyMember.getStartDateLiving());
		setPhone(familyMember.getPhone());
		setMobile(familyMember.getMobile());
		setZipCode(familyMember.getZipCode());
		setContactAddress(familyMember.getContactAddress());
	}
	
	
	@Transient
	public String getIdTypeAlias() {
		return idType;
	}

}
